fix(shc): wait for all SHC members before captain bootstrap to eliminate pod restart - #924
Draft
vivekr-splunk wants to merge 1 commit into
Draft
fix(shc): wait for all SHC members before captain bootstrap to eliminate pod restart#924vivekr-splunk wants to merge 1 commit into
vivekr-splunk wants to merge 1 commit into
Conversation
…restart On first boot, all SHC pods start simultaneously. The captain pod's ansible runs 'bootstrap shcluster-captain' which needs to contact all other members. However, other pods take ~8-10 minutes to start Splunk (measured: 499s on EKS), while the default retry window is only shc_sync_retry_num(60) × retry_delay(6s) = 360s — too short. Result: bootstrap times out, ansible exits with code 2, K8s restarts the captain pod. The second ansible run succeeds (other members are now up), but adds ~16 minutes to SHC first-boot readiness. Fix: - Add a pre-bootstrap wait task on the captain that polls each non-captain member's REST endpoint until reachable, using shc_sync_retry_num retries. - Raise shc_sync_retry_num from 60 to 100 in splunk_defaults_linux.yml (100 × 6s = 600s, covering first-boot Splunk start time with margin). Windows already uses 300. With this fix, the captain waits for other members before attempting bootstrap, eliminating the race condition and the unnecessary pod restart. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On first boot, all SHC pods start simultaneously. The designated captain pod's ansible role runs
bootstrap shcluster-captain, which internally contacts all other SHC members. However, other pods take 8–10 minutes to start Splunk on first boot (measured: ~499s on EKS with warm images).The default retry window for this step is:
360s < 499s → bootstrap times out before other members are reachable → ansible exits with code 2 → K8s restarts the captain pod.
The second ansible run succeeds because all members now have Splunk running, but this adds ~16 minutes to SHC first-boot readiness time and causes unnecessary pod restarts in Kubernetes-managed deployments.
Fix
1. Add a pre-bootstrap wait on the captain pod (
search_head_clustering.yml)Before calling
bootstrap shcluster-captain, the captain now polls each non-captain member's REST endpoint until reachable, usingshc_sync_retry_numretries:2. Raise
shc_sync_retry_numfor Linux (splunk_defaults_linux.yml)Changed from 60 to 100 (100 × 6s = 600s), covering the observed first-boot Splunk start time with margin. Windows already uses 300; this brings Linux inline with the same order of magnitude.
Effect
splunk_search_head_captain | boolValidation
Tested on EKS with 3-member SHC (noah-mode, operator-managed):
AI Assistance
Implemented with Claude Code assistance.